home *** CD-ROM | disk | FTP | other *** search
/ Day Cry / Day Cry CD.bin / oh_towns / taropyon / splib / splib.lzh / PRG / LHX / SLIDEHUF.H < prev    next >
C/C++ Source or Header  |  1992-11-03  |  3KB  |  105 lines

  1. #include "lh386.h"
  2.  
  3. #include <stdio.h>
  4. #include <limits.h>
  5. #include "typedef.h"
  6. #include "errmes.h"
  7.  
  8. struct encode_option
  9. {
  10.     void        (*output) ();
  11.     void        (*encode_start) ();
  12.     void        (*encode_end) ();
  13. };
  14.  
  15. struct decode_option
  16. {
  17.     ushort(*decode_c) ();
  18.     ushort(*decode_p) ();
  19.     void        (*decode_start) ();
  20. };
  21.  
  22. /* from slide.c */
  23. #define MAX_DICBIT      13
  24. #define MAX_DICSIZ (1U << MAX_DICBIT)
  25. #define MATCHBIT   8            /* bits for MAXMATCH - THRESHOLD */
  26. #define MAXMATCH 256            /* formerly F (not more than UCHAR_MAX + 1) */
  27. #define THRESHOLD  3            /* choose optimal value */
  28.  
  29. extern int    unpackable;
  30. extern ulong origsize, compsize;
  31. extern ushort dicbit;
  32. extern ushort maxmatch;
  33. extern ulong count;
  34. extern ushort loc;
  35. #if 0
  36. extern uchar *text;
  37. #else
  38. extern uchar text[];
  39. #endif
  40.  
  41. /* from huf.c */
  42. #define NC (UCHAR_MAX + MAXMATCH + 2 - THRESHOLD)
  43. /* alphabet = {0, 1, 2, ..., NC - 1} */
  44. #define CBIT 9                    /* $\lfloor \log_2 NC \rfloor + 1$ */
  45. #define USHRT_BIT 16            /* (CHAR_BIT * sizeof(ushort)) */
  46.  
  47. extern ushort left[], right[];
  48. extern uchar c_len[], pt_len[];
  49. extern ushort c_freq[], c_table[], c_code[], p_freq[], pt_table[], pt_code[], t_freq[];
  50.  
  51. void        output_st1(ushort c, ushort p);
  52. void       *alloc_buf(void);
  53. void        encode_start_st1(void);
  54. void        encode_end_st1(void);
  55. ushort        decode_c_st1(void);
  56. ushort        decode_p_st1(void);
  57. void        decode_start_st1(void);
  58.  
  59. /* from shuf.c */
  60. void        decode_start_st0(void);
  61. void        encode_p_st0(unsigned short j);
  62. void        encode_start_fix(void);
  63. void        decode_start_fix(void);
  64. ushort        decode_c_st0(void);
  65. ushort        decode_p_st0(void);
  66.  
  67. /* from dhuf.c */
  68. extern uint n_max;
  69.  
  70. void        start_c_dyn(void);
  71. void        decode_start_dyn(void);
  72. ushort        decode_c_dyn(void);
  73. ushort        decode_p_dyn(void);
  74. void        output_dyn(int code, unsigned int pos);
  75. void        encode_end_dyn(void);
  76.  
  77. /* from larc.c */
  78. ushort        decode_c_lzs(void);
  79. ushort        decode_p_lzs(int loc);
  80. ushort        decode_c_lz5(void);
  81. ushort        decode_p_lz5(int loc);
  82. void        decode_start_lzs(void);
  83. void        decode_start_lz5(void);
  84.  
  85. /* from maketbl.c */
  86. void        make_table(short nchar, uchar bitlen[], short tablebits, ushort table[]);
  87.  
  88. /* from maketree.c */
  89. void        make_code(short n, uchar len[], ushort code[]);
  90. short        make_tree(short nparm, ushort freqparm[], uchar lenparm[], ushort codeparam[]);
  91.  
  92. /* from crcio.c */
  93. extern FILE *infile, *outfile;
  94. extern ushort crc, bitbuf;
  95. extern int    dispflg;
  96.  
  97. void        fillbuf(uchar n);
  98. ushort        getbits(uchar n);
  99. void        putcode(uchar n, ushort x);
  100. void        putbits(uchar n, ushort x);
  101. int         fread_crc(uchar * p, int n, FILE * f);
  102. void        fwrite_crc(uchar * p, int n, FILE * f);
  103. void        init_getbits(void);
  104. void        init_putbits(void);
  105.